<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="{php echo $this->cur_mobile_path}/css/api.css"/>
    <link rel="stylesheet" type="text/css" href="{php echo $this->cur_mobile_path}/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="{php echo $this->cur_mobile_path}/css/order-new.css?v=1"/>
    <link rel="stylesheet" type="text/css" href="{php echo $this->cur_mobile_path}/css/fakeLoader.css">
    <script src="{php echo $this->cur_mobile_path}/script/jquery-1.8.3.min.js"></script>
    <link rel="stylesheet" href="{php echo $this->cur_mobile_path}/mvalidate/validate.css" />
    <script type="text/javascript" src="{php echo $this->cur_mobile_path}/mvalidate/jquery-mvalidate.js" ></script>
</head>
<body>
<style>
    .am-btn {
        display: inline-block;
        margin-bottom: 0;
        padding: 5px 10px;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.2;
        text-align: center;
        white-space: nowrap;
        background-image: none;
        border: 1px solid transparent;
        border-radius: 0;
        cursor: pointer;
        outline: 0;
        -webkit-appearance: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-transition: background-color .3s ease-out,border-color .3s ease-out;
        transition: background-color .3s ease-out,border-color .3s ease-out;
    }
    .am-form-file {
        position: relative;
        overflow: hidden;
    }
    .am-btn-danger {
        color: #fff;
        background-color: #fc9733;
        border-color: #fc9733;
    }
    .am-form-file input[type=file] {
        position: absolute;
        left: 0;
        top: 0;
        z-index: 1;
        width: 100%;
        opacity: 0;
        cursor: pointer;
        font-size: 50rem;
    }
</style>
<form method="post" enctype="multipart/form-data"
      action="{php echo $this->createMobileUrl('admincate', array('op' => 'post', 'storeid' => $storeid), true)}">
    <input type="hidden" name="token" value="{$_W['token']}" />
    <input type="hidden" name="id" value="{$id}" />
<div id="wrap">
    <header class="bar bar-nav">
        <a class="button button-link button-nav pull-left" href="javascript:void(0)" onclick="history.go(-1)">
            <span class="icon-left"></span>
        </a>
        <h1 class="title">商品分类添加</h1>
    </header>
    <div class="content">
        <div class="list-block address-editor">
            <ul class="full-width-form">
                <li class="item-content">
                    <div class="item-inner">
                        <div class="item-title label">排序:</div>
                        <div class="item-input">
                            <input type="text" placeholder="" name="displayorder" id="displayorder"
                                   value="{$item['displayorder']}">
                        </div>
                    </div>
                </li>
                <li class="item-content">
                    <div class="item-inner">
                        <div class="item-title label">分类名称:</div>
                        <div class="item-input">
                            <input type="text" placeholder="请输入您的商品名称" name="title" id="title" value="{$item['name']}">
                        </div>
                    </div>
                </li>
                <li class="item-content">
                    <div class="item-inner">
                        <div class="item-title label">
                            支持店内:
                        </div>
                        <div class="item-input">
                            <label class="label-checkbox item-content" style="width: 22%;">
                                <input type="radio" name="is_meal" value="1" {if $item['is_meal']==1}checked{/if}>
                                <div class="item-media">
                                    <i class="icon icon-form-checkbox"></i>
                                    <span>&nbsp;开启</span>
                                </div>
                            </label>
                            <label class="label-checkbox item-content" style="width: 22%;">
                                <input type="radio" name="is_meal" value="0" {if $item['is_meal']==0}checked{/if}>
                                <div class="item-media">
                                    <i class="icon icon-form-checkbox"></i>
                                    <span>&nbsp;关闭</span>
                                </div>
                            </label>

                        </div>
                    </div>
                </li>
                <li class="item-content">
                    <div class="item-inner">
                        <div class="item-title label">
                            支持外卖:
                        </div>
                        <div class="item-input">
                            <label class="label-checkbox item-content" style="width: 22%;">
                                <input type="radio" name="is_delivery" value="1" {if $item['is_delivery']==1}checked{/if}>
                                <div class="item-media">
                                    <i class="icon icon-form-checkbox"></i>
                                    <span>&nbsp;开启</span>
                                </div>
                            </label>
                            <label class="label-checkbox item-content" style="width: 22%;">
                                <input type="radio" name="is_delivery" value="0" {if $item['is_delivery']==0}checked{/if}>
                                <div class="item-media">
                                    <i class="icon icon-form-checkbox"></i>
                                    <span>&nbsp;关闭</span>
                                </div>
                            </label>

                        </div>
                    </div>
                </li>
                <li class="item-content">
                    <div class="item-inner">
                        <div class="item-title label">
                            支持预定:
                        </div>
                        <div class="item-input">
                            <label class="label-checkbox item-content" style="width: 22%;">
                                <input type="radio" name="is_reservation" value="1" {if $item['is_reservation']==1}checked{/if}>
                                <div class="item-media">
                                    <i class="icon icon-form-checkbox"></i>
                                    <span>&nbsp;开启</span>
                                </div>
                            </label>
                            <label class="label-checkbox item-content" style="width: 22%;">
                                <input type="radio" name="is_reservation" value="0" {if $item['is_reservation']==0}checked{/if}>
                                <div class="item-media">
                                    <i class="icon icon-form-checkbox"></i>
                                    <span>&nbsp;关闭</span>
                                </div>
                            </label>

                        </div>
                    </div>
                </li>
                <li class="item-content">
                    <div class="item-inner">
                        <div class="item-title label">
                            支持快餐:
                        </div>
                        <div class="item-input">
                            <label class="label-checkbox item-content" style="width: 22%;">
                                <input type="radio" name="is_snack" value="1" {if $item['is_snack']==1}checked{/if}>
                                <div class="item-media">
                                    <i class="icon icon-form-checkbox"></i>
                                    <span>&nbsp;开启</span>
                                </div>
                            </label>
                            <label class="label-checkbox item-content" style="width: 22%;">
                                <input type="radio" name="is_snack" value="0" {if $item['is_snack']==0}checked{/if}>
                                <div class="item-media">
                                    <i class="icon icon-form-checkbox"></i>
                                    <span>&nbsp;关闭</span>
                                </div>
                            </label>

                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</div>
<nav class="bar bar-tab">
    <div align="center" style="margin-bottom: 50px;" class="button button-fill delivery-button-submit">
        <button type="submit" name="submit" value="submit" class="am-btn am-btn-success am-radius" style="color:#fff;">确认提交</button>
    </div>
</nav>
</form>
<div class="popup-overlay"></div>
<script type="text/javascript">
    $('#add-distance').click(function(){
        $('#distance-list').append($('#distance-form-html').html());
    });
</script>
<script type="text/javascript">
    function settype(type) {
        $("#type").val(type)
    }

    function postmain() {
        $("#btnselect").hide();
        if (true) {
            var url = "{php echo $this->createMobileUrl('adminmoney', array('op' => 'post', 'storeid' => $storeid), true)}";
            var totalprice = parseFloat($("#totalprice").val());
            $.ajax({
                url: url, type: "post", dataType: "json", timeout: "10000",
                data: {
                    "price": totalprice
                },
                success: function (data) {
                    if (data.message['code'] != 0) {
                        $.mvalidateTip('已申请提现请等待管理员审核！');
                        setTimeout(jumptourl, 2000);
                    } else {
                        $.mvalidateTip(data.message['msg']);
                    }
                    $("#btnselect").show();
                }, error: function () {
                    alert("提交失败！");
                }
            });
        } else {
            $("#btnselect").show();
        }
    }

    function jumptourl() {
        var url = "{php echo $this->createMobileUrl('adminstore', array(), true)}";
        location.href = url;
    }
    $("#btnselect").click(function () {
        var bool = checkItem();
        if (bool) {
            postmain();
        }
    });

    function checkItem() {
        curprice = parseFloat($("#curprice").val());
        if (curprice <= 0) {
            $.mvalidateTip("你当前没有余额!");
            return false;
        }

        totalprice = parseFloat($("#totalprice").val());
        if (totalprice <= 0) {
            $.mvalidateTip("请输入要提现的金额!");
            return false;
        }

        if (totalprice > curprice) {
            $.mvalidateTip("提现的金额不能大于您的余额!");
            return false;
        }
        return true;
    }
</script>
</body>
</html>
